UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r3B3o0cXs0q2tHHdwkja/Abul1Pk7yrowfKdqMhTH4I='
WHERE
key_id = 'a6da490efb383c282df7b577561247f214a403e3a5616f08fd0c8acb915a876d'
AND (
token = 'r3B3o0cXs0q2tHHdwkja/Abul1Pk7yrowfKdqMhTH4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)