UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fp7T1Lp5tbL69+bi3dpbs6nptvbg1p4XPEWFpJiZv00='
WHERE
key_id = 'f76f17abf6f4568448e536e22a71957550afb5825ac19beb09e8d693e1abe40a'
AND (
token = 'fp7T1Lp5tbL69+bi3dpbs6nptvbg1p4XPEWFpJiZv00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)