UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RyJM3B0NYmgv0PmcuKncTm5osv9wNpNyOoH1j9+ADJI='
WHERE
key_id = 'dfca8d2ea048e52b2033522a1842cebd2b665e179cd722499333967c09d21a25'
AND (
token = 'RyJM3B0NYmgv0PmcuKncTm5osv9wNpNyOoH1j9+ADJI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)