UPDATE 
  q_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYvnRtdYicBeYb2I/6W7XmVYh5p5x85aPUxGGhbWW/E=' 
WHERE 
  key_id = 'c285203624299534c9d47c348f218569b65d4f3f26da703b176515d15d4aaf96' 
  AND (
    token = 'cYvnRtdYicBeYb2I/6W7XmVYh5p5x85aPUxGGhbWW/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026