UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'afNy395ZNAau+F7h4lEPMIdDq1A+U0D1DhnmX7JSVlI='
WHERE
key_id = '4d04a028bfd33dffc43d125a53ea3b9950a3c4805a365c31d0172b5807ebdf30'
AND (
token = 'afNy395ZNAau+F7h4lEPMIdDq1A+U0D1DhnmX7JSVlI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)