UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pQJsilcrSZ0MKZDPU9dBAQAkvUGbj8iTSO2MH0nqJVE='
WHERE
key_id = '082bb773ed6b4392cb794b0903e1e598dc508b6e9507d7db7e422f46341c7ad8'
AND (
token = 'pQJsilcrSZ0MKZDPU9dBAQAkvUGbj8iTSO2MH0nqJVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)