UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E7Dn/8rXNCRaopmFY+1ughDwYDozpfP/k2P5LoCNPH4=' 
WHERE 
  key_id = 'aa16bbe9435da611de334630d3cf9f1dc4265e0de2fcc4d11139082fa95c7d78' 
  AND (
    token = 'E7Dn/8rXNCRaopmFY+1ughDwYDozpfP/k2P5LoCNPH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030