UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cOOcOb2hof5i3pah8zU1Wv5uWydONZtcwAOUN4GcQqg='
WHERE
key_id = '48613c327494046a343a583446573540a9cb4791c21c4ae52eb3fb0e2e8de4e8'
AND (
token = 'cOOcOb2hof5i3pah8zU1Wv5uWydONZtcwAOUN4GcQqg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)