UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'edaUK2Oc20vx0AySesLZIoOkzwq3nC6MO1hI7FKikZ0='
WHERE
key_id = '36d3e7d114cb8ce09d5d89a09dc88eee5b56301f2c1b42bda217bbc8d4f669cd'
AND (
token = 'edaUK2Oc20vx0AySesLZIoOkzwq3nC6MO1hI7FKikZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)