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