UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3jaiFJA5hS9y/83+nq2LnbDjNx0UysSolBImCqrdbXo=' 
WHERE 
  key_id = '2f5d465ece39bacc029d1ca11ed64959399382e1ed581df3298db56e727b4c4c' 
  AND (
    token = '3jaiFJA5hS9y/83+nq2LnbDjNx0UysSolBImCqrdbXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024