UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y9MSznlmw6fsUISpQGPJoba64OZmKH+nhVg8Y19wt+A='
WHERE
key_id = 'ab5cc72adec1ab9cae3b9597d41e7039c965dfb6f7c8a74a95c5fda9d324da64'
AND (
token = 'Y9MSznlmw6fsUISpQGPJoba64OZmKH+nhVg8Y19wt+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)