UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dcl/DK3wZBZhgqhF6XLveSuX0q/Fl5nEvsDkphofTzI=' 
WHERE 
  key_id = '8d947f63afdf6a52ad4e6fcfb0ef4217183e3924f7926a670203c13f206895c8' 
  AND (
    token = 'Dcl/DK3wZBZhgqhF6XLveSuX0q/Fl5nEvsDkphofTzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030