UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '07Tip6Y+C0SpeMk6smzcMnubEigJ4J3ttwMuUZgY0Ms='
WHERE
key_id = '3d0a243fc42397ec798450593c2404d54c8645c8d5b5dfe9b4663d94d08fcbd8'
AND (
token = '07Tip6Y+C0SpeMk6smzcMnubEigJ4J3ttwMuUZgY0Ms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)