UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bazwjF+Rq9mE4rHbFalvTp36+dQTrrfSn5Nymx7Abx0='
WHERE
key_id = '5c6310342dd423b0378c4f778b4c9c740a47607b0daa7aecff908f9f32ae78e5'
AND (
token = 'bazwjF+Rq9mE4rHbFalvTp36+dQTrrfSn5Nymx7Abx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)