UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i0G59w5NSGU64wFjFZdXKAuQJsIO4y8po0hUVBvhL3E='
WHERE
key_id = '964fb5f4e3320626c4d9f2df72222f5bb1b419ea08d5e1d157b0e78411c1783c'
AND (
token = 'i0G59w5NSGU64wFjFZdXKAuQJsIO4y8po0hUVBvhL3E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)