UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GhrNVcK0skHqOyEKeguHRVZ8CYtPAdA14+8fKB0XwzM='
WHERE
key_id = 'dae1720259c23626e79876cee1b62402da2f82e03fb82559e022386c6496b0ff'
AND (
token = 'GhrNVcK0skHqOyEKeguHRVZ8CYtPAdA14+8fKB0XwzM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)