UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YF2R7tYTgEKOnMvOmzwmr6yOuES+31bom7KHY7GWe1M='
WHERE
key_id = 'e354af1f4c30be334afbe928b0b24383b9a95c10dcf790f703b2b918d69a60ed'
AND (
token = 'YF2R7tYTgEKOnMvOmzwmr6yOuES+31bom7KHY7GWe1M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)