UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0tYh7P8HjzZWLIDML+hHWf1mnooiSes3TMNXon5TJiM='
WHERE
key_id = '31de2449ab3c79efb0ee4e1dfe568da7b664fb4efed1a4ed8f6146a6cb1de4da'
AND (
token = '0tYh7P8HjzZWLIDML+hHWf1mnooiSes3TMNXon5TJiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)