UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cdPEp3GLBNE4U65wJVPn4bvehPgMbXUdVL6RHm8CTAw=' 
WHERE 
  key_id = '4108f0d23437c41ff38193ad078d32f65c207b8424baef8bf9c844f4e7d885c2' 
  AND (
    token = 'cdPEp3GLBNE4U65wJVPn4bvehPgMbXUdVL6RHm8CTAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022