UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5+fx4iATdnure2WFODOCw41VzeXYpEPx6eo6XRYUia0=' 
WHERE 
  key_id = 'd5ec2788f545e208b03eb1da481e131b288ba1bf68d7442a9b65455a2a1211c1' 
  AND (
    token = '5+fx4iATdnure2WFODOCw41VzeXYpEPx6eo6XRYUia0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025