UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yj3kF3u/NLS1SRaKanOl3XPW/qn7NQzjGa5yRZhBgO0=' 
WHERE 
  key_id = '8cdf38e00d28259058d2873c952d689782e134741719a209750dd78cb617cbd1' 
  AND (
    token = 'yj3kF3u/NLS1SRaKanOl3XPW/qn7NQzjGa5yRZhBgO0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030