UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SzBwkELM5P63UZUeK57vmPqFOIA/8by5eBuPadyPy+Y=' 
WHERE 
  key_id = '20f0c2c7e2dce585e0890e697e2b7ee242d3da44ad8fae579d7c95303dfed574' 
  AND (
    token = 'SzBwkELM5P63UZUeK57vmPqFOIA/8by5eBuPadyPy+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036