UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ooGrhXS/VIAyprkn6K4Jf21b038hWz6KKvax0+wIZbw=' 
WHERE 
  key_id = '888b52f01ad2ddd964140c55efe6dbaa33e132403c70185d73cdcea9a4d30130' 
  AND (
    token = 'ooGrhXS/VIAyprkn6K4Jf21b038hWz6KKvax0+wIZbw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044