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