UPDATE 
  q_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zaNpxmL3IC8VRLgzVMmHbH+vwMGZIh2qBjVWmSq0X88=' 
WHERE 
  key_id = 'ef66f633af47d883b6f70b9f7b4055af7b541bfb2fd988d37e721706f12c1f8b' 
  AND (
    token = 'zaNpxmL3IC8VRLgzVMmHbH+vwMGZIh2qBjVWmSq0X88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027