UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7DyCy0pCbBEM7RQHZsrWsKKn78ups1xAYuOIjBIZkNI='
WHERE
key_id = '4829502b1fac1db6c5f30b36e15430f315461f47dee24308cd7c80b1a94a5581'
AND (
token = '7DyCy0pCbBEM7RQHZsrWsKKn78ups1xAYuOIjBIZkNI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)