UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rYq17yo/CIxlzLIcJzMjnVf/CE4VUCRXa/eiTH+s08o='
WHERE
key_id = '9e409ffe62f0d36402965c7017f74fb4a50df4a437091ba6183c8b7ea3b8b80e'
AND (
token = 'rYq17yo/CIxlzLIcJzMjnVf/CE4VUCRXa/eiTH+s08o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)