UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TMbn1/tkDyQrM/Jzz7agagsPKo61PudeimuWi2IKD6M=' 
WHERE 
  key_id = '7cd488326db862c157df973b383b04202115805030971e783ece4d5c29d3a488' 
  AND (
    token = 'TMbn1/tkDyQrM/Jzz7agagsPKo61PudeimuWi2IKD6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028