UPDATE 
  q_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ygBP8+isD4O/R9tQLZhfMmwYTxGHDjQplin0xThlKm8=' 
WHERE 
  key_id = 'a0a92b446bcd797b1acbe069771786f1caf4b1d2c4ab275ba9fde0d59f3b1fc0' 
  AND (
    token = 'ygBP8+isD4O/R9tQLZhfMmwYTxGHDjQplin0xThlKm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029