UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a88fcXc8DkrECS+6vheo87pmXfHyPyo+80JtY+0DIJ0='
WHERE
key_id = 'bbc16bb4ba48b8d07e07aed73256aa20814c9f4b7a173042560f1fb9842dcea4'
AND (
token = 'a88fcXc8DkrECS+6vheo87pmXfHyPyo+80JtY+0DIJ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)