UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MwZTi2Y6qG6qaFqeq0J8DnBrkt7NZOw5xOPsc2tJf4s='
WHERE
key_id = '519970ea7e6d476063d493eaa73966379cfa984ddd8e6a3c71e944a1be2baedf'
AND (
token = 'MwZTi2Y6qG6qaFqeq0J8DnBrkt7NZOw5xOPsc2tJf4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)