UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '42BqoFBQq84YlnDTV4F6Uuwss7W6kFibw5HaY3QVZq4=' 
WHERE 
  key_id = '3691699c2211599bac43633a5514423b1d6d212f337adccc3a65c7ad8ba7744f' 
  AND (
    token = '42BqoFBQq84YlnDTV4F6Uuwss7W6kFibw5HaY3QVZq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083