UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y4581vGrSDqGNFf2VDl9JT87tX6V8CPFneHuDI7y7Ns=' 
WHERE 
  key_id = '6c0193f6321d733c476524446d8cf14e9ba2e3ef1723b5ecb79123c458538da0' 
  AND (
    token = 'Y4581vGrSDqGNFf2VDl9JT87tX6V8CPFneHuDI7y7Ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027