UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3eK7uA+6h0xfjcbOUF2FFnuLj8liD2EBc1dWLMVrdy0=' 
WHERE 
  key_id = '7697ca019fd669037b217c88442a8d8e33f07a44e456cc7185e0eacece956e44' 
  AND (
    token = '3eK7uA+6h0xfjcbOUF2FFnuLj8liD2EBc1dWLMVrdy0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034