UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fNDZaZjlB7YurjneyWSpuvbG/wMnGRPiXN+cJDnz6i0='
WHERE
key_id = '38c5aa34b94a05f53c9e810baca29b26785dd39291ba2078cb00dea8331cf989'
AND (
token = 'fNDZaZjlB7YurjneyWSpuvbG/wMnGRPiXN+cJDnz6i0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)