UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UyMky0H97KESl5MfTgx0/MYiHIdlC9f8o8sAIAyanfI=' 
WHERE 
  key_id = '2ecdea9729e0efb638268d3d7a05921a7843fa0f2602a2f378c28493f3681144' 
  AND (
    token = 'UyMky0H97KESl5MfTgx0/MYiHIdlC9f8o8sAIAyanfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033