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