UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Er8r69WsWVs80nK7ez4R7gIHYn+Nw2tWMy31EBvTzSw='
WHERE
key_id = 'f8973c577d3146186ed1a2a86049d87278afe1a94bff499a45e0befa934d408a'
AND (
token = 'Er8r69WsWVs80nK7ez4R7gIHYn+Nw2tWMy31EBvTzSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)