UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0uKkgmF9VNndmgsLQ7N85rsed1kV6ChG8d1sdrUDB+M='
WHERE
key_id = '5daecc752060b0db7c655ca95b74c4f3c04773317fe5b2daece7a7ce9302ed51'
AND (
token = '0uKkgmF9VNndmgsLQ7N85rsed1kV6ChG8d1sdrUDB+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)