UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yLKsQ42WFC3V5IG64WNvS1NZmM9un9BIStd29Kk5jD0='
WHERE
key_id = 'e370958bbb05386cd51e1e5a95c22873d4fafa123489af34e3a85a6f92645c0d'
AND (
token = 'yLKsQ42WFC3V5IG64WNvS1NZmM9un9BIStd29Kk5jD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)