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