UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x2CD02jkRUWJgsb0KFefAgpllmx1Vbr6mCOjvHF1CoE='
WHERE
key_id = 'ad758c03c8ded1a85dc54cfa28c8df15e6ea5413d474cdaf257d79aa100d5c41'
AND (
token = 'x2CD02jkRUWJgsb0KFefAgpllmx1Vbr6mCOjvHF1CoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)