UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YEdO5fSx9B3bRD7AD9QCK5JlLv2PHed3P7bMAoxePRM='
WHERE
key_id = 'f6cb468b3b568965cc20839857048df0b898c81c05ea8afad3fdd39d7368e730'
AND (
token = 'YEdO5fSx9B3bRD7AD9QCK5JlLv2PHed3P7bMAoxePRM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)